package com.bjsxt.controller.system;

import com.bjsxt.dto.OperLogDto;
import com.bjsxt.service.OperLogService;
import com.bjsxt.vo.AjaxResult;
import com.bjsxt.vo.DataGridView;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 接口控制器
 *
 * @author Administrator
 * @title: OperLogController
 * @projectName open-his
 * @description: TODO
 * @date 2021/1/19 0019
 */
@Log4j2
@RestController
@RequestMapping("system/operLog")
public class OperLogController {

    @Autowired
    private OperLogService operLogService;

    /**
     * 分页查询
     *
     * @param operLogDto
     * @return
     */
    @GetMapping("listForPage")
    public AjaxResult listForPage(OperLogDto operLogDto) {
        DataGridView gridView = operLogService.listForPage(operLogDto);
        return AjaxResult.success("查询成功", gridView.getData(), gridView.getTotal());
    }

    /**
     * 删除
     *
     * @param infoIds
     * @return
     * @PathVariable 将URL中占位符参数绑定到控制器处理方法的入参中，即URL中的{*}占位符可以通过@PathVariable绑定到操作方法的入参中
     */
    @DeleteMapping("deleteOperLogByIds/{infoIds}")
    public AjaxResult deleteOperLogByIds(@PathVariable Long[] infoIds) {
        return AjaxResult.success(this.operLogService.deleteOperLogByIds(infoIds));
    }

    /**
     * 清空删除
     *
     * @return
     */
    @DeleteMapping("clearAllOperLog")
    public AjaxResult clearAllOperLog() {
        return AjaxResult.toAjax(this.operLogService.clearAllOperLog());
    }


}
